package com.gm.bean;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;

import javax.persistence.*;

/**
 * @Author Administrator
 * @Date 2020/6/19 15:53
 **/
//使用JPA注解来去配置映射关系的实体
//@Table指定和那个数据表进行映射，如果没有数据表的情况下，就是指定创建的表名，
// 如果不给值，表名默认使用类名，并且类名首字母小写
@Entity     //告诉JPA这是一个实体类，和数据表映射的实体
@Table(name = "tb_user")
@JsonIgnoreProperties(value = {"hibernateLazyInitializer"})
public class User {
    @Id //这是一个主键
    @GeneratedValue(strategy = GenerationType.IDENTITY)  //主键自增
    private Integer id;
    @Column(name = "user_name",length = 30)  //这是和数据库表字段相对应的属性
    private String userName;
    @Column  //省略参数，默认使用属性名作为数据表的列名
    private String password;
    @Column
    private String address;
    @Column
    private String birth;

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getUserName() {
        return userName;
    }

    public void setUserName(String userName) {
        this.userName = userName;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public String getAddress() {
        return address;
    }

    public void setAddress(String address) {
        this.address = address;
    }

    public String getBirth() {
        return birth;
    }

    public void setBirth(String birth) {
        this.birth = birth;
    }
}
